home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Examples / GMExample / GMExample_My.c next >
Encoding:
C/C++ Source or Header  |  1997-06-17  |  5.7 KB  |  260 lines

  1. /*
  2. ** $VER: GMExample_My.c 1.006 (25.02.96) © Gian Maria Calzolari
  3. **
  4. **
  5. **  FUNCTION:
  6. **      Generic IEditor test with many gadgets
  7. **
  8. ** $HISTORY:
  9. **
  10. ** 25 Feb 1996 : 001.006 : Final release for v2.25!
  11. ** 17 Feb 1996 : 001.005 : Corrected error in NULL pointed ARexx strings
  12. ** 07 Feb 1996 : 001.004 : Changed and adapted to IE 2.25
  13. ** 01 Jan 1996 : 001.003 : Adapted to use the IE generated main!
  14. ** 23 Dec 1995 : 001.002 : Added AREXX header :-(
  15. ** 17 Dec 1995 : 001.002 : The ARexx interface now works, DICE doesn't open
  16. **                          RexxSysLib without declaring the RexxSysBase
  17. **                          library struct! :-(
  18. ** 08 Dec 1995 : 001.001 : Added an ARexx test cmd
  19. ** 12 Nov 1995 : 001.000 : Updated with IE 2.19, added texts and ver string.
  20. **                          First /real/ public release! :-)
  21. ** 29 Oct 1995 : 000.002 : Adapted to IE v2.17 and translated to English!
  22. ** 12 Oct 1995 : 000.001 : ...first version...
  23. **
  24. */
  25.  
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <string.h>
  29. #include <errno.h>
  30. #include <rexx/storage.h>
  31.  
  32. #define INTUI_V36_NAMES_ONLY
  33. #define ASL_V38_NAMES_ONLY
  34.  
  35. #include <clib/dos_protos.h>
  36.  
  37. #include "GMExample.h"
  38. #include "GMExample_rev.h"
  39.  
  40. const char ver[]       = VERSTAG " by Gian Maria Calzolari";
  41. const char version[]   = VSTRING " by Gian Maria Calzolari FidoNet 2:332/502.11";
  42.  
  43. void    MySetup(void);
  44. int     HandleCtrlC(void);
  45.  
  46. extern struct Library  *SysBase;
  47. extern                  Ok_to_Run;
  48.  
  49. UWORD   Scelta = 0;     // MX ChooseMe current value
  50. #define SCELTA_MAX 2    // MX ChooseMe max value
  51.  
  52. void MySetup()
  53. {
  54.     if (SysBase->lib_Version < 37)
  55.         Error("You need at least KickStart", ">= 37 (2.04)");
  56.  
  57.     onbreak(HandleCtrlC);
  58.  
  59.     // Put my version into the text gadget
  60.     GT_SetGadgetAttrs(MiaFinGadgets[GD_Text], MiaFinWnd, NULL,
  61.             GTTX_Text, version,
  62.             TAG_END);
  63. }
  64.  
  65.  
  66. /* -------------------------------- HandleCtrlC --------------------------------
  67.  
  68.  Comment:
  69.  
  70.  CTRL + C management (this works ONLY with the DICE's onbreak function)
  71.  
  72. */
  73.  
  74. int HandleCtrlC(void)
  75. {
  76.     End(RETURN_WARN);
  77.     return TRUE;
  78. }
  79.  
  80.  
  81. /*
  82.     C/E source code created by Interface Editor
  83.     Copyright © 1994-95 by Simone Tellini Software
  84.  
  85.     Copy registered to :  Gian Maria Calzolari - Beta Tester 2
  86.     Serial Number      : #2
  87. */
  88.  
  89. /*
  90.    In this file you'll find empty template routines
  91.    referenced in the GUI source.  You can fill this
  92.    routines with your code or use them as a reference
  93.    to create yor main program.
  94. */
  95.  
  96. BOOL SubItem1Menued( void )
  97. {
  98.     printf("Routine for menu *Menù1/Item1/SubItem1*\n");
  99.     return TRUE;
  100. }
  101.  
  102. BOOL SubItem2aMenued( void )
  103. {
  104.     printf("Routine for menu *Menù1/Item2/SubItem2a*\n");
  105.     return TRUE;
  106. }
  107.  
  108. BOOL SubItem2bMenued( void )
  109. {
  110.     printf("Routine for menu *Menù1/Item2/SubItem2b*\n");
  111.     return TRUE;
  112. }
  113.  
  114. LONG GetTheStringRexxed( ULONG *ArgArray, struct RexxMsg *Msg )
  115. {
  116.     TEXT buffer[11];
  117.  
  118.     printf("Routine for the *GetTheString* ARexx command\n");
  119.  
  120.     strcpy(buffer, GetString(MiaFinGadgets[GD_Stringa]) );
  121.  
  122.     Msg->rm_Result2 = CreateArgstring(buffer, strlen(buffer) );
  123.  
  124.     return(0L);
  125. }
  126.  
  127. LONG PutTheStringRexxed( ULONG *ArgArray, struct RexxMsg *Msg )
  128. {
  129.     printf("Routine for the *PutTheString* ARexx command\n");
  130.  
  131.     GT_SetGadgetAttrs(MiaFinGadgets[GD_Stringa], MiaFinWnd, NULL,
  132.             GTST_String, ArgArray[0],
  133.             TAG_END);
  134.  
  135.     return(0L);
  136. }
  137.  
  138. LONG QuitRexxed( ULONG *ArgArray, struct RexxMsg *Msg )
  139. {
  140.     printf("Routine for the *QUIT* ARexx command\n");
  141.  
  142.     Ok_to_Run = MiaFinCloseWindow();
  143.     return(0L);
  144. }
  145.  
  146. LONG Gimme5Rexxed( ULONG *ArgArray, struct RexxMsg *Msg )
  147. {
  148.     printf("Routine for the *GIMMEFIVE* ARexx command\n");
  149.  
  150.     printf("All Right, [");
  151.  
  152.     if ( (STRPTR)ArgArray[0] )
  153.         printf("%s", (STRPTR)ArgArray[0] );
  154.  
  155.     printf("] [");
  156.  
  157.     if ( (STRPTR)ArgArray[1] )
  158.         printf("%s", (STRPTR)ArgArray[1] );
  159.  
  160.     printf("]!\n");
  161.  
  162.     return(0L);
  163. }
  164.  
  165. BOOL MiaFinCloseWindow( void )
  166. {
  167.     printf("Routine for IDCMP_CLOSEWINDOW\n");
  168.     return FALSE;
  169. }
  170.  
  171. BOOL BottoneClicked( void )
  172. {
  173.     printf("Routine when *_Button!* clicked\n");
  174.     return TRUE;
  175. }
  176.  
  177. BOOL BottoneKeyPressed( void )
  178. {
  179.     printf("Routine when *_Button!*'s activation key is pressed\n");
  180.  
  181.     /*  ...or return TRUE not to call the gadget function  */
  182.     return BottoneClicked();
  183. }
  184.  
  185. BOOL PaletteClicked( void )
  186. {
  187.     printf("Routine when *Palette* clicked\n");
  188.     return TRUE;
  189. }
  190.  
  191. BOOL SceglimiClicked( void )
  192. {
  193.     printf("Routine when *_Choose me!* clicked\n");
  194.  
  195.     Scelta = MiaFinMsg.Code;
  196.  
  197.     printf("You chose <%s>\n", SceglimiLabels[Scelta] );
  198.  
  199.     return TRUE;
  200. }
  201.  
  202. BOOL SceglimiKeyPressed( void )
  203. {
  204.     printf("Routine when *_Choose me!*'s activation key is pressed\n");
  205.  
  206.     if (Scelta < SCELTA_MAX)
  207.         Scelta++;
  208.       else
  209.         Scelta = 0;
  210.  
  211.     GT_SetGadgetAttrs(MiaFinGadgets[GD_Sceglimi], MiaFinWnd, NULL,
  212.         GTMX_Active, Scelta,
  213.         TAG_END);
  214.  
  215.     MiaFinMsg.Code = Scelta;
  216.  
  217.     /*  ...or return TRUE not to call the gadget function  */
  218.     return SceglimiClicked();
  219. }
  220.  
  221. BOOL NumeroClicked( void )
  222. {
  223.     LONG numero;
  224.  
  225.     printf("Routine when *Key in a _number* clicked\n");
  226.  
  227.     numero = GetNumber( MiaFinGadgets[GD_Numero] );
  228.     printf("Gadget value: <%d>\n", numero);
  229.  
  230.     return TRUE;
  231. }
  232.  
  233. BOOL StringaClicked( void )
  234. {
  235.     TEXT stringa[11];
  236.  
  237.     printf("Routine when *Key in a _string* clicked\n");
  238.  
  239.     strcpy(stringa, GetString( MiaFinGadgets[GD_Stringa] ) );
  240.     printf("Gadget value: <%s>\n", stringa);
  241.  
  242.     return TRUE;
  243. }
  244.  
  245. BOOL ProvaImgClicked( void )
  246. {
  247.     printf("Routine when *BooleanGadget* clicked\n");
  248.     return TRUE;
  249. }
  250.  
  251. BOOL MiaFinVanillaKey( void )
  252. {
  253.     printf("Routine for not a gadget related key pressed!\n");
  254.  
  255.     printf("...you pressed <%c>\n", MiaFinMsg.Code);
  256.  
  257.     return TRUE;
  258. }
  259.  
  260.